FROM mongo:4.2.7
MAINTAINER zhanghb
ENV TZ=Asia/Shanghai
ENV SITEURL=localhost:9000

ADD run.sh /root/
RUN set -ex; \
    rm /etc/apt/sources.list.d/*; \
    apt-get update; \
    apt-get install -y --no-install-recommends wget tar nano; \
    apt-get install -y \
        fonts-arphic-bkai00mp \
        fonts-arphic-bsmi00lp \
        fonts-arphic-gbsn00lp \
        fonts-arphic-gkai00mp \
        fonts-arphic-ukai \
        fonts-arphic-uming \
        ttf-wqy-zenhei \
        ttf-wqy-microhei \
        xfonts-wqy; \


    # download wkhtmltopdf
    wget https://gitee.com/drfly/leanote/releases/download/v1.0/wkhtmltox_0.12.6-1.bionic_arm64.deb; \
    apt install ./wkhtmltox_0.12.6-1.bionic_arm64.deb -y; \
    # remove install cache
    rm -rf /var/lib/apt/lists/*; \

    #download leanote
    wget https://gitee.com/drfly/leanote/releases/download/v1.0/leanote_ubuntu18_arm64_zhang_v1.0.tar.bz2; \
    tar xf leanote_ubuntu18_arm64_zhang_v1.0.tar.bz2 -C /root/; \

    rm -f /root/leanote.tar.gz ;\
    rm -rf leanote_ubuntu18_arm64_zhang_v1.0.tar.bz2 wkhtmltox_0.12.6-1.bionic_arm64.deb; \
    chmod a+x /root/www/run.sh ;\
    echo 'export QT_QPA_PLATFORM=offscreen' >> ~/.bashrc ;\
    ln -snf /usr/share/zoneinfo/$TZ /etc/localtime ;\
    echo $TZ > /etc/timezone

EXPOSE 8096
# CMD ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && /bin/bash /root/run.sh
CMD /bin/bash /root/run.sh

